package com.groupnections.client.LiveFeed;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.groupnections.client.Entities.EntityPage;
import com.groupnections.shared.Entity;
import com.groupnections.shared.LiveFeed;

public class ListLiveFeed {

	public ListLiveFeed(final Entity entity) {

		final LiveFeedDatabaseServerCallsAsync databaseServerCalls = GWT
				.create(LiveFeedDatabaseServerCalls.class);

		databaseServerCalls.listLiveFeeds(entity,
				new AsyncCallback<LiveFeed[]>() {

					public void onSuccess(LiveFeed[] liveFeeds) {

						EntityPage.vpMiddleContent.clear();
						EntityPage.vpMiddleContent.add(new ListFeedPanel(
								entity, liveFeeds));
					}

					public void onFailure(Throwable caught) {
						// Show the RPC error message to the user

					}

				});

	}
}
